/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.farmcode.plugin.objectinfo.jdbc;

import com.farmcode.api.plugin.ObjectInfoPlugin;
import com.farmcode.api.plugin.objectinfo.ObjectInfoPluginManager;
import com.farmcode.api.plugin.objectinfo.PluginManagerDescriptor;
import com.farmcode.api.plugin.objectinfo.PluginNotFoundException;
import com.farmcode.plugin.objectinfo.jdbc.plugin.ObjectInfoJDBCProcedurePlugin;
import com.farmcode.plugin.objectinfo.jdbc.plugin.ObjectInfoJDBCTablePlugin;
import com.farmcode.plugin.objectinfo.jdbc.plugin.ObjectInfoJDBCViewPlugin;

/**
 *
 * @author oscar
 */
public class JDBCManagerPlugin extends PluginManagerDescriptor implements  ObjectInfoPluginManager {

    public JDBCManagerPlugin() {
        super("com/farmcode/plugin/objectinfo/jdbc/descriptor.properties");
    }
    
    @Override
    public ObjectInfoPlugin getPlugin(String name) throws PluginNotFoundException {
        ObjectInfoPlugin objectInfoPlugin;
        if(name.equals("table")){
            objectInfoPlugin = new ObjectInfoJDBCTablePlugin(); 
        }else if(name.equals("view")){
            objectInfoPlugin = new ObjectInfoJDBCViewPlugin();
        }else if(name.equals("procedure")){
            objectInfoPlugin = new ObjectInfoJDBCProcedurePlugin();
        }else{
            throw new PluginNotFoundException();
        } 
        
        return objectInfoPlugin;
    }
    
}
